<template>
  <div id="App">

    <keep-alive>
      <left v-if="flag"></left>
      <right v-else></right>
    </keep-alive>
    <button @click="flag=!flag">点击</button>
  </div>
</template>
<script>

import Left from "@/components/left.vue";
import Right from "@/components/right.vue";

export default {
  name: "App",
  components: {Right, Left},
  data() {
    return {
      flag: true
    }
  },
}
</script>
<style lang="less">

</style>
